function [NameSI1 NameSI2 Date Ri RI] = getStock_Index(SI1, SI2)

[NameSI1 DateS RRi] = getStock(SI1);
[NameSI2 DateI RRI] = getIndex(SI2);

if (sum(size(RRi)) > 2 || sum(size(RRI)) > 2)
    [nS mS] = size(DateS);
    [nI mI] = size(DateI);
    n = min(nS, nI);
    Date = 0;
    temp = 1;
    if (n ~= 0)
        b = 0;
        i = 1; s = 1; t = 1;
        while ((i <= nI) && (s <= nS))
            cmp = myCmpStr(DateI(i, :), DateS(s, :));
            if (cmp == 0)
                if (temp)
                    Date = [DateI(i, :)];
                    Ri = [RRi(s)];
                    RI = [RRI(i)];
                    temp = 0;
                else
                    Date = [Date; DateI(i, :)];
                    Ri = [Ri; RRi(s)];
                    RI = [RI; RRI(i)];
                end
                t = t + 1;
            elseif (cmp > 0)
                b = 0;
            else
                b = 1;
            end
            
            if (b == 0)
                i = i + 1;
            else
                s = s + 1;
            end
        end
    else
        Date = 0;
        Ri = 0;
        RI = 0;
    end
else
    Date = 0;
    Ri = 0;
    RI = 0;
end